<html><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>签订《提分宝典》服务保障合同</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/queren.css">
    <link rel="stylesheet" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/generate.css">
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/layer_mobile/layer.js"></script><link href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/layer_mobile/need/layer.css?2.0" type="text/css" rel="styleSheet" id="layermcss">
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/layer.css">
    <script src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/jquery.1.9.1.js"></script>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/rem.js"></script><style>html{font-size:50px;}</style>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.css">
  <style>
    .example{padding: 0.6rem;font-weight: bold;padding-bottom: 0.2rem;}
    .addressmone ul li input{text-indent: 0.3rem;}
    .huoqu{background-color: #4a77b0;}
    .addressmone ul{margin-bottom: 0.5rem;}
    .buttonbox{padding: 0 0.45rem;}
    .dotm_btn1{background-color: #4a77b0;}
    .errinfo{color: #fb0e1b;margin-top: 0.2rem;font-size: 0.26rem;line-height: 0.4rem;/* display: none; */}
  </style>
</head>
<body class="body_tj" style="font-size: 16px;">
<div id="tbh5v0">
    <div class="addressmone">
    <div class="example">
      您已经成功购买了《提分宝典》，可以在此签订《提分宝典》服务保障合同，签定之前需要验证您的手机号码。
    </div>
        <ul>
          
            <li>
                <span>手机号码</span>
                <em>
                    <input style="width: 98%;height: 0.7rem;" type="number" pattern="[0-9]*" name="" id="phone" value="" placeholder="请填写您的手机号码">
                </em>
            </li>
            <li style="position: relative;">
                <span>验证码</span>
                <em>
                    <input style="width: 60%;height: 0.7rem;" type="number"  oninput="if(value.length>4) value = value.slice(0,4)" name="" id="yzm" pattern="[0-9]*" value="" placeholder="请输入验证码">
                    <div class="huoqu">获取验证码</div>
                </em>
            </li>
      <p class="errinfo"  style="display:none">您输入的手机号码与预设的不匹配，请重新填写或联系购买商家</p>
        </ul>
    
        <div class="buttonbox">
            <input type="submit" value="去签合同" class="dotm_btn1">
        </div>

    </div>
</div>

<script>
  $(function(){
    $('.huoqu').click(function() {
      var tel = $('#phone').val();
      if(!(/^1[3456789]\d{9}$/.test(tel))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      $.ajax({
          type: 'post',
          url:"/index/pdfadmin/check/type/{$type}/ids/{$ids}" ,
          data:{mobile:tel},
          success: function(data){
            console.log(data);
            if(data.code != 1){
              layer.open({
                content:data.msg ,
                skin: 'msg',
                time: 2 //2秒后自动关闭
              });
                $('.errinfo').show();
              return false
            }else{
                 $('.errinfo').hide();
                   $.ajax({
                    type: 'post',
                    url:"/api/sms/send" ,
                    data:{mobile:tel,event:'contract_check'},
                    success: function(data){
                      console.log(data);
                      if(data.code != 1){
                        layer.open({
                          content:data.msg ,
                          skin: 'msg',
                          time: 2 //2秒后自动关闭
                        });
                        return false
                      }else{
                        var count = 120;
                        const countDown = setInterval(() => {
                          if (count === 0) {
                            $('.huoqu').text('重新发送').removeAttr('disabled');
                            $('.huoqu').css({
                              background: '#f3494c',
                              color: '#fff',
                            });
                            clearInterval(countDown);
                          } else {
                            $('.huoqu').attr('disabled', true);
                            $('.huoqu').css({
                              background: '#eee',
                              color: '#333',
                            });
                            $('.huoqu').text(count + '秒后可重新获取');
                          }
                          count--;
                        }, 1000);
                      }
                    }
                  });
            }
          }
        });
   
    });

    $('.dotm_btn1').click(function(){
      var student_name = $('#student_name').val();
      var parent_name = $('#parent_name').val();
      var gender = $('input[name="gender"]:checked').val();
      var id_card = $('#id_card').val();
      var grade = $('#grade').val();
      var last_exam = $('#last_exam').val();
      var address = $('#address_').val();
      var phone = $('#phone').val();
     
      var yzm = $('#yzm').val();
      
      if(!(/^1[3456789]\d{9}$/.test(phone))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
           $("#phone").focus();
        return false;
      }

      if(yzm == ""||yzm == null){
        layer.open({
          content: '请填写验证码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
          $("#yzm").focus();
        return false;
      }
      // $.ajax({
      //         type: 'post',
      //         url:"/index/pdfadmin/login/type/2/ids/50" ,
      //         data:{mobile:phone},
      //         success: function(data){
      //           layer.close(index);
      //            layer.open({
      //               content: data.msg,
      //               skin: 'msg',
      //               time: 2, //2秒后自动关闭
      //             });
      //           if(data.code == 0){
      //             $('.dotm_btn1').attr("disabled","");
      //             return false;
      //           }else{
      //            window.location.href="/index/pdfadmin/generate/type/2/ids/50"; 
      //           }
                

      //         }
      //       });

        var index = layer.open({type: 2});
      //验证验证码
      $.ajax({
        type: 'post',
        url:"/api/sms/check" ,
        data:{mobile:phone,captcha:yzm,event:'contract_check'},
        success: function(data){
          if(data.code == 0){
            layer.close(index);
            layer.open({
              content: data.msg,
              skin: 'msg',
              time: 2,
            });
            return false;
          }else{
            //添加禁止标签
            $('.dotm_btn1').attr("disabled","disabled");
            $.ajax({
              type: 'post',
              url:"/index/pdfadmin/login/type/{$type}/ids/{$ids}" ,
              data:{mobile:phone},
              success: function(data){
                layer.close(index);
                 layer.open({
                    content: data.msg,
                    skin: 'msg',
                    time: 2, //2秒后自动关闭
                  });
                if(data.code == 0){
                  $('.dotm_btn1').removeAttr("disabled");
                  $('.errinfo').show();
                  return false;
                }else{
                  window.location.href="/index/pdfadmin/generate/type/{$type}/ids/{$ids}"; 
                }
                

              }
            });
          }
        }
      });


    });
  });




</script>


</body></html>